<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ComputerList</title>
</head>
<body>
<form action="computerlist.jsp">
	<table border="1">
	  <tr>
	    <th colspan="4">计算机图书</th>
	  </tr>
	  <tr>
	    <td>微服务架构设计模式</td>
	    <td>￥109.00</td>
	    <td><button><a href="buy.jsp?book=微服务架构设计模式">购买</a></button></td>
	    <td><button><a href="buy.jsp?delbook=微服务架构设计模式">删除</a></button></td>
	  </tr>
	  <tr>
	    <td>Spring Boot编程思想</td>
	    <td>￥70.00</td>
	    <td><button><a href="buy.jsp?book=Spring Boot编程思想">购买</a></button></td>
	    <td><button><a href="buy.jsp?delbook=Spring Boot编程思想">删除</a></button></td>
	  </tr>
	  <tr>
	    <td>C Primer Plus</td>
	    <td>￥49.50</td>
	    <td><button><a href="buy.jsp?book=C Primer Plus">购买</a></button></td>
	    <td><button><a href="buy.jsp?delbook=C Primer Plus">删除</a></button></td>
	  </tr>
	</table>
	<button><a href="buy.jsp">查看购物车</a></button>
</form>

	<%
		ArrayList books = (ArrayList)session.getAttribute("books");
		if (books == null) {
			books = new ArrayList();
			session.setAttribute("books", books);
		}
		String book = request.getParameter("book");
	%>
</body>
</html>